<template>
	<view>
		<view v-show="ifshow" class="popup-layer">
			<view ref="maskRef" class="show-content" @tap="ableClose" @touchmove.stop.prevent>
				<view class="show_arrow" style="font-size: 13px !important;">点击这里分享给好友<image class="mask_arrow"  src="../../static/icon/arrow.png" mode=""></image></view>
				<view class="show_text">
					<view class="show_title">
						<span>邀请好友注册</span>
						<span>赢取更多积分</span>
						<span>兑换商品服务</span>
					</view>
					<view class="show_item" style="font-size: 12px !important;">
						<view>ps:</view>
						<view>&nbsp;&nbsp;1) 如果有未注册商城的用户,通过您的链接进入商城,你将获取到对应的积分;</view>
						<view>&nbsp;&nbsp;2) 邀请好友的数量越多,您获取的积分越多;</view>
						<view>&nbsp;&nbsp;3) 积分可以兑换供销社 教育服务类, 课程类产品, 解释权归坤物供销社所有 </view>
					</view>
				</view>
			</view>	
		</view>
	</view>
</template>

<script>
	export default {
		name: 'mask-ui',
		model: {
			prop: "showMask",
			event: "change"
		},
		props: {
			showMask:{
				type:Boolean,
				default:false,
			},
			autoClose: {
				type: Boolean,
				default: true,
			}
		},
		data() {
			return {
				ifshow: false, // 是否展示,
				timer: null,
			};
		},
		computed: {
		},
		mounted(){
			if(this.showMask){
				// console.log(222);
				this.show();
			}
		},
		watch:{
			showMask(value){
				console.log(value)
				if(value){
					this.show();
				}else{
					this.close();
				}
			}	
		},
		methods: {
			// stopMove(event){
			// 	console.log(11);
			// 	console.log(event);
			// 	return;
			// },
			show(events) {
				this.ifshow = true;
				let _open = setTimeout(() => {
					this.translateValue = 0;
					_open = null;
				}, 100)
			},
			close() {
				this.timer = setTimeout(() => {
					this.ifshow = false;
					this.timer = null;
					this.$emit('closeCallBack', null);
					this.$emit('change',false)
				}, 100);
			},
			ableClose() {
				if (this.autoClose) {
					this.close();
				}
			},
			doSome(){
				console.log(111222111111111);
			}

		}
	}
</script>

<style lang="scss">
	.popup-layer {
		position: fixed;
		z-index: 99;
		background: rgba(0, 0, 0, .5);
		height: 100%;
		width: 100%;
		top: 0px;
		left: 0px;
		overflow: hidden;
	}

	.show-content {
		color: white;
		width:100%;
		height: 100%;
		transition: all .3s ease;
		display: flex;
		flex-direction: column;
		padding: 40upx;
		box-sizing: border-box;
		.show_arrow {
			display: flex;
		    text-align: right;
			align-items: center;
			justify-content: flex-end;
			margin-right: -20upx;
			.mask_arrow {
				width: 50upx;
				height: 50upx;
			}
		}
		.show_text {
			display: flex;
			flex-direction: column;
			flex-warp: warp;
			margin-top: 160upx;
			.show_title {
				font-weight: 700;
				font-size: 40upx;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
			}
			.show_item {
				margin-top: 90upx;
				padding: 40upx;
				box-sizing: border-box;
				font-size: 24upx !important;
			}
		}
	}
</style>
